package edu.poly.game.console;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class SystemConsole {
	
	private static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
	
	public static String askForInput(final String message) {
		System.out.println(message);
		
		try {
			String userInput = input.readLine();
			return userInput;
		} catch (IOException io) {
			io.printStackTrace();
		}
		return null;
	}
	
	public static void printMessage(final String message) {
		System.out.println(message);
	}
	
	public static void printGameGrid(final char[][] grid1, final char[][] grid2) {
		for(int x = 0; x < grid1.length; x++) {
			for(int y = 0; y < grid1[x].length; y++) {
				System.out.print(String.format("%2c", grid1[x][y]));
			}
			
			System.out.print(String.format("%10s", " "));
			
			for(int y = 0; y < grid2[x].length; y++) {
				System.out.print(String.format("%2c", grid2[x][y]));
			}
			System.out.println();
		}
		System.out.println();
	}
	
	public static void closeConsole() {
		if(input != null) {
			try {
				input.close();
			} catch(IOException e) {
				e.printStackTrace();
			}
		}
	}
}
